package sctu.edu.java.year2016.team01.xuhanmei.day20160529.KnowStatic;

/**
 * Created by Administrator on 2016/5/29.
 */
public class MaxMin {
    public static class Result{//静态内部类
        private double max;
        private double min;
        public Result(double max,double min){//静态内部类中的方法
            this.max=max;
            this.min=min;
        }
        public double getMax(){
            return max;
        }
        public double getMin(){
            return min;
        }

    }
    public static Result getResult(double[] array){
        double max=Double.MIN_VALUE;
        double min=Double.MAX_VALUE;
        for(double i:array){
            if(i>max){
                max=i;
            }
            if(i<min){
                min=i;
            }
        }
        return new Result(max,min);
    }

}
